package com.fortune.service.impl;

import com.fortune.dao.ClientDao;
import com.fortune.dto.in.client.ClientAddDto;
import com.fortune.dto.in.client.ClientEditDto;
import com.fortune.service.ClientService;
import com.fortune.vo.cPriceMgt.CClientList;
import com.fortune.vo.client.Client;
import com.fortune.vo.client.ClientDetail;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ClientServiceImpl implements ClientService {

    @Autowired
    private ClientDao clientDao;

    /**
     * 有效客户
     * @return
     */
    @Override
    public List<Client> findEffectiveClient(String mid,String did) {
        List<Client> findEffectiveClient = clientDao.findEffectiveClient(mid,did);
        return findEffectiveClient;
    }

    /**
     * 无效客户
     * @return
     */
    @Override
    public List<Client> findInvalidClient(String mid,String did) {
        List<Client> findInvalidClient = clientDao.findInvalidClient(mid, did);
        return findInvalidClient;
    }

    /**
     * 全部客户
     * @return
     */
    @Override
    public List<Client> findAllClient(String mid,String did) {
        List<Client> findAllClient = clientDao.findAllClient(mid, did);
        return findAllClient;
    }

    /**
     * 根据客户id查询客户详情
     * @param clientId
     * @return
     */
    @Override
    public ClientDetail findClientDetailByClientId(String clientId,String mid,String did) {
        ClientDetail findClientDetailByClientId = clientDao.findClientDetailByClientId(clientId,mid,did);
        return findClientDetailByClientId;
    }

    /**
     * 添加客户
     * @param clientAddDto
     * @return
     */
    @Override
    public int addClient(ClientAddDto clientAddDto, String id, String mid, String did, String userId) {
        String name = clientAddDto.getName();
        int addClient = clientDao.addClient(clientAddDto,id,mid,did,userId);
        return addClient;
    }

    /**
     * 修改客户信息
     * @param clientEditDto
     * @return
     */
    @Override
    public int editClient(ClientEditDto clientEditDto, String mid, String did) {
        int editClient = clientDao.editClient(clientEditDto,mid,did);
        return editClient;
    }

    /**
     * 查询有效的总条数
     * @param mid
     * @param did
     * @return
     */
    @Override
    public int findEffectiveAcount(String mid, String did) {
        int findEffectiveAcount = clientDao.findEffectiveAcount(mid, did);
        return findEffectiveAcount;
    }

    /**
     * 查询无效的总条数
     * @param mid
     * @param did
     * @return
     */
    @Override
    public int findInvalidAcount(String mid, String did) {
        int findInvalidAcount = clientDao.findInvalidAcount(mid, did);
        return findInvalidAcount;
    }

    /**
     * 查询全部总条数
     * @param mid
     * @param did
     * @return
     */
    @Override
    public int findAllClientAcount(String mid, String did) {
        int findAllClientAcount = clientDao.findAllClientAcount(mid, did);
        return findAllClientAcount;
    }

    /**
     * 根据厂商id和经销商id查询客户信息
     * @param companyId
     * @param dealerId
     * @return
     */
    @Override
    public List<CClientList> queryClientList(String companyId, String dealerId) {
        return clientDao.queryClientList(companyId,dealerId);
    }


}
